package com.ymttest.database.mongo;

import java.util.ArrayList;
import java.util.Map;

import com.ymt.database.MongoDBDriver;

public class ProductVersionInfoWapper {
	
	MongoDBDriver mdd = YmtMongoDriverFactroy.getInstance_ProductSnapshotDBdriverNew("ProductVersionInfo");

	public ProductVersionInfoWapper()  {
	}
		

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public Map<String,Object> getVersionInfoByProductIdAndVer(String productId, int ver) throws Exception {
		ArrayList<Map> list = mdd.selectPartLimitToMap("{\"pid\":\"" + productId + "\", 'ver':" + ver + "}" ,1);
	    
	    return list.size()>0?list.get(0):null;
	}
	
	public static void main(String[] args) throws Exception {
		ProductVersionInfoWapper wapper = new ProductVersionInfoWapper();
		System.out.println(wapper.getVersionInfoByProductIdAndVer("5ce247f7-cae9-4685-99d8-2677672925b1", 1001).get("pkey").toString());
	}
}
